<?php
include_once "filtro_cabecera.php";
include_once "../funciones/funciones_php.php";

?>
    <br />
    <div id="titulo_seccion">
	    <fieldset>
        <table>
	        <tr>
	            <td><font>Asignar Chofer Ruta</font></td>
	        </tr>
	    </table>
        </fieldset>
	</div>
<br />
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Lectura de encomiendas</title>

<link rel="stylesheet" type="text/css" href="../css/tabla.css" />
        <script type="text/javascript" src="../js/jquery-1.5.2.js"></script>
		<script type="text/javascript" src="../js/jquery-ui-1.8.14.custom.min.js"></script>
        <script type='text/javascript' src='../js/jquery.autocomplete.js'></script>
        <script type="text/javascript" src="../js/jquery.validate.js"></script>
        <script type='text/javascript' src='../js/funciones_js.js'></script>
		<link type="text/css" href="../css/start/jquery-ui-1.8.14.custom.css" rel="Stylesheet" />
		<!--<link type="text/css" href="../css/demos.css" rel="Stylesheet" />-->
		<!--<link rel="stylesheet" type="text/css" href="../css/thickbox.css" />-->
        <link rel="stylesheet" type="text/css" href="../css/plantilla.css" />
		<link rel="stylesheet" type="text/css" href="../css/jquery.autocomplete.css" />
		<link rel="stylesheet" type="text/css" href="../css/menu.css" />
  <script>
        $(document).ready(function()
        {
            $('#cancelar').button();
            $('#guardar').button();
        });

</script>
</head>
<body>
<form action="guardar_chofer_ruta.php" method="post">
<?php
$id_ruta = $_GET['ruta'];
conectar();
$pg = sprintf("SELECT *
               FROM ruta
               WHERE id_ruta = '%s'",pg_escape_string($id_ruta));
$conectar = pg_query($pg) or die("Error en la consulta".pg_error());

$row = pg_fetch_array($conectar);

$ruta = $row['referencia'];
$id_ruta = $row['id_ruta'];

echo "<fieldset>";
echo "<table>";
echo "<tr>";
echo "<td>Ruta</td><td>".$ruta."</td>";
echo "</tr><tr>";
echo "<td>Chofer</td><td>";
$pg_c = sprintf("SELECT *
                 FROM empleado
                 WHERE empleado.id_tipo_empleado = '%d'",pg_escape_string(3));
$cons_chof = pg_query($pg_c) or die ("ERROR");

echo "<select name='empleado'>";

while ($reg2 = pg_fetch_array($cons_chof))
{
    echo "<option value=".$reg2['id_empleado'].">".$reg2['nombre']."";
}
echo "</td>";
echo "</tr>";
echo "</table>";
echo "<input type='hidden' name='ruta' value='".$id_ruta."'>";
echo "<input type='submit' value='Guardar' name='guardar' id='guardar'/>";
echo "<input type=button value='Cancelar' id='cancelar' onclick='cerrar_ventana()'>";

echo "</fieldset>";
?>
</form>
</body>
</html>